import React from 'react';
import { connect } from 'dva'
import { routerRedux } from 'dva/router';
import { Icon, List, WhiteSpace, SearchBar, WingBlank} from 'antd-mobile';
import banner1 from '../../../../assets/work/banner2.jpg';
import banner4 from '../../../../assets/work/banner6.jpg';


const Item = List.Item;
const Brief = Item.Brief;
class dangyuanlist extends React.Component{
  constructor(props){
    super(props);
    this.state={
    }
    if (this.props.location.query.code) {
      console.log("dangyuanlist"+this.props.location.query.code);
      this.props.dispatch({
        type: 'dangyuanlists/fetch',
        payload:{code:this.props.location.query.code,relation:["extend"]},
      });
    }
  }

  render(){
    return(
      <div>
          <WhiteSpace/>
        {this.props.list&&
          < List >
            < Item  thumb={this.props.list.photo?this.props.list.photo:banner4}>
        {this.props.list.name ? this.props.list.name : ''}
          <Brief>
          {this.props.list.job ? this.props.list.job : ''}
          </Brief>
          </Item>
          </List>
        }
        <WhiteSpace/>
        {this.props.list&&
          <List>
          <Item extra={this.props.list.type ? this.props.list.type : ''}>党员类型</Item>
          <Item extra={this.props.list.nation ? this.props.list.nation : ''}>民族</Item>
          <Item extra={this.props.list.native_place ? this.props.list.native_place : ''}>籍贯</Item>
          </List>
        }
          <WhiteSpace/>
        {this.props.list&&
          <List>
          <Item extra={this.props.list.idcard ? this.props.list.idcard : ''} wrap={true}>身份证码</Item>
          <Item extra={this.props.list.phone ? this.props.list.phone : ''}>手机号码</Item>
          <Item extra={this.props.location.query.name ? this.props.location.query.name : ''} >所属组织</Item>
          </List>
        }
        <WhiteSpace/>
        {this.props.list&&
          <List>
          <Item extra={this.props.list.extend? this.props.list.extend.apply_date : ''}>申请入党日</Item>
          <Item extra={this.props.list.extend ? this.props.list.extend.full_member_date : ''}>转为正式党员日期</Item>
          </List>
        }
        <WhiteSpace/>
        {this.props.list &&
        <List>
          <Item extra={this.props.list.education ? this.props.list.education : ''}>学历</Item>
          <Item extra={this.props.list.job ? this.props.list.job : ''}>工作单位</Item>
          <Item extra={this.props.list.extend ? this.props.list.extend.home_address : ''} wrap={true}>通讯地址</Item>
        </List>
        }
      </div>
    )
  }
}

function mapStateToProps({dangyuanlists}) {
    console.log(dangyuanlists.menberInfo);
    return {
      list: dangyuanlists.menberInfo
    }

}

export default connect(mapStateToProps)(dangyuanlist);
